# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Maintainer: Orhun Parmaksız <orhun@archlinux.org>
# Contributor: João Vitor S. Anjos <jvanjos at protonmail dot com>

pkgname=jless
pkgver=0.8.0
pkgrel=1
pkgdesc='A command-line pager for JSON data'
arch=('loong64' 'x86_64')
url="https://github.com/PaulJuliusMartinez/jless"
license=('MIT')
depends=('gcc-libs' 'libxcb' 'libxkbcommon')
makedepends=('git' 'rust' 'python')
options=('!lto')
_commit='6f3b7bbe8ca463467a389ffe3c473993e4c4acd8'
source=("$pkgname::git+$url.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$pkgname"

  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd "$pkgname"

  cargo build --release --frozen
}

check() {
  cd "$pkgname"

  cargo test --frozen
}

package() {
  cd "$pkgname"

  # binary
  install -vDm755 -t "$pkgdir/usr/bin" target/release/jless

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}

# vim:set ts=2 sw=2 et:
